package com.sleep.ruledemo.context;

import cn.hutool.core.convert.Convert;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @ClassName TestContent
 * @Description TODO
 * @Author 郭敖
 * @Date 2024年05月05日 13:25
 * @Version 1.0
 */
@Data
public class TestContent {
    private Map<String,Object> context = new ConcurrentHashMap<>();

    public <T> T getData (String key,Class<T> clazz){
        return Convert.convert(clazz,context.get(key));
    }

    public void setData(String key,Object value){
        context.put(key,value);
    }
}
